import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import viteCompression from 'vite-plugin-compression';
// import ViteComponents, { AntDesignVueResolver } from 'vite-plugin-components';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    viteCompression()
    // ViteComponents({
    //   //antd按需引入
    //   customComponentResolvers: [AntDesignVueResolver()]
    // }),
  ],
  resolve: {
    alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
  },
  css: {
    preprocessorOptions: {
      less: {
        //配置less全局样式变量mixins
        globalVars: {
          variable: `true; 
          @import (reference) "${path.resolve(__dirname, './src/styles/variable.less')}";
          @import (reference) "${path.resolve(__dirname, './src/styles/mixins.less')}";
          `,
        },
        javascriptEnabled: true,
      }
    }
  }
});
